package jdk8_new_features;

import java.util.*;
import java.util.stream.Collectors;

public class LambadPractice {
	
	
	public static void main(String[] args) {
		
		List<Integer> aList = new ArrayList<Integer>();
		
		List<String> list = Arrays.asList("abc", "eqwr", "bcd", "qb" , "ehdc", "jk");
		List<String> subList = list.stream().filter(o -> o.contains("c")).collect(Collectors.toList());
		subList.stream().forEach(System.out::println);
		
		subList.stream().map(i -> i.toUpperCase()).forEach(System.out::println);
				
		
		List<Integer> intList = Arrays.asList(1,2,3,5,7,9,11,12);
		intList.stream().reduce((a,b) -> {
			System.out.println("a=" + a + ",b=" + b);
			return a + b;
		} ).get();






		IntSummaryStatistics intSummaryStatistics = intList.stream().mapToInt((o) -> o).summaryStatistics();
		
		System.out.println("max=" + intSummaryStatistics.getMax());
		System.out.println("min=" + intSummaryStatistics.getMin());
		System.out.println("sum=" + intSummaryStatistics.getSum());
		System.out.println("avager=" + intSummaryStatistics.getAverage());
		System.out.println("count=" + intSummaryStatistics.getCount());


		
	}

}
